import com.lbi.core.events.EventDispatcher;
import com.lbi.framework.mvc.collection.Collection;
import com.lbi.framework.mvc.collection.Selectable;
import com.lbi.framework.mvc.io.xml.XMLListLoader;
import com.lbi.framework.mvc.io.xml.XMLModel;
import com.lbi.framework.mvc.model.IEventMapper;
import com.lbi.framework.mvc.view.ViewBase;
import com.lbi.framework.mvc.model.EventMapper;
/**
 * @author michaelforrest
 */
class example.app.models.Person extends Selectable implements IEventMapper{
	private static var XML_URL : String			= "xml/people.xml";
	private static var COLLECTION_PATH : String = "people.person";
	private static var COLLECTION_NAME : String = "people"; 

	public  static var people : Collection;

	public static function prepare() : EventDispatcher{
		return XMLListLoader.initialize(
								Person, 
								COLLECTION_NAME, 
								XML_URL, 
								COLLECTION_PATH
								);
	}
	
	// the public properties of a Person model	
	public var image_url : String;
	public var name : String;
	public var role_id : Number;

	// constructor takes an xmlmodel
	public function Person(model : XMLModel) {
		EventMapper.initialize(this);
		name = model.name;
		image_url = model.image;
		role_id = model.role_id;
		deselect();
	}
	// These methods are autogenerated by FDT and left empty.
	// Our call to EventMapper.initialize(this) fills these methods in.
	public function registerEvents(view : ViewBase, events : Array, class_name_for_debugging : String) : Void {
	}
	public function getPossibleEvents() : Array {
		return null;
	}
	public function eventIsPossible(event_name : String) : Boolean {
		return null;
	}
}